// JavaScript Document
function validate()
{
	var empno = document.getElementById('txtSearch');
	var yr = document.getElementById('sltYr');
	var mon = document.getElementById('sltMon');
	
	
	if(notEmpty(empno, "Search cannot be empty")){
		 if(isNumeric(empno, "Employee No should be numeric ")){
			 if(madeSelection(yr, "Select the year")){ 
	             if(madeSelection(mon, "Select the Month")){ 
		                 return true;
				 			}
		        	return false;
				 }
			 return false
		 	}
		return false
		}
	return false
}
	
	
	
	
	
	
		function onDel(id)
{
		
		//currentRow = td.parent;
if(confirm("Do You Want To Delete?")){

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		
		var tr = document.getElementById(id).parentNode.parentNode;
		tr.parentNode.removeChild(tr);
//document.getElementById(id).innerHTML=xmlhttp.responseText;
    }
  }

    	var queryString = "?id=" + id; 
		
xmlhttp.open("GET","../logic/delete/att_employee_delete.php"+queryString ,true);
xmlhttp.send();
}
}





function checkempno(){

var empno = document.getElementById('txtSearch');
if(notEmpty(empno, "Search cannot be empty")){

 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
    }
  else
   {// code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
    xmlhttp.onreadystatechange=function()
     {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
									//document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText; 
									 
   var x=xmlhttp.responseText;
if(x=="false"){
									
  document.getElementById("ajaxDiv1").innerHTML="Invalid Employee No";
  document.getElementById('txtSearch').value="";
	}else{
  document.getElementById("ajaxDiv1").innerHTML=x; 
									
			}
			}
            }
								
  var y=document.getElementById('txtSearch').value;
  var queryString ="?empno=" + y;
  xmlhttp.open("GET","../logic/load/check_emp.php"+queryString,true);
  xmlhttp.send();	  
	
	
}
}
	